home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 30 / Amiga Format AFCD30 (Sep 1998, Issue 114).iso / -seriously_amiga- / workbench / -datatypes- / aksvg / akdt_install next >
Text File  |  1998-06-18  |  15KB  |  387 lines

  1. ;********************************************************************************
  2. ;            __     ____           __           __                 
  3. ;           / /__  / __ \        _/ /_        _/ /_               
  4. ;   ______ / // / / / / /______ /  __/______ /  __/__  __ ______ ______
  5. ;  / __  // _  / / / / // __  / / /  / __  / / /   \ \/ // __  // ____/
  6. ; / __  // /| | / /_/ // __  / / /_ / __  / / /_    \  // /_/ // __/_
  7. ;/_/ /_//_/ |_|/_____//_/ /_/ /___//_/ /_/ /___/    / // ____//_____/
  8. ;                                                  /_// /    
  9. ; akJFIF, akLJPG, akPNG, akSVG, akGIF, FAXX          /_/    
  10. ;
  11. ; $VER: akDT_Installer 0.98q (May-19-1998)
  12. ; Installer by Robert C. Reiswig ©1996,1997,1998
  13. ;
  14. ; If you wish to use any part of this installer you must ask. May not be 
  15. ; integrated/placed into any other package! Changes, suggestions or problems:
  16. ; akDatatype@vgr.com 
  17. ;--------------------------------------------------------------------------------
  18. ;
  19. ;********************************************************************************
  20. (if (= @user-level 0) (set @user-level 1))
  21. (set whereback "SYS:Storage")
  22. (set dtdest (tackon whereback "Datatypes"))
  23. (set cksum 0)
  24.  
  25. (foreach "classes/datatypes" "#?.datatype" (set wakdt @each-name) ) 
  26. ;(set vernum1 (getversion (cat "classes/datatypes/" wakdt))) (set ver1 (/ vernum1 65536)) 
  27. ;(set rev1 (- vernum1 (* ver1 65536) ) ) (set akdtver (cat ver1 "." rev1))
  28.  
  29. (set cpu (database "cpu")) 
  30. (if (> (exists ("sys:libs/68060.library")) 0) (set #cpu 5) )
  31. (if (= cpu 68000) (set #cpu 0)) (if (= cpu 68010) (set #cpu 1))
  32. (if (= cpu 68020) (set #cpu 2)) (if (= cpu 68030) (set #cpu 3))
  33. (if (= cpu 68040) (set #cpu 4)) (if (= cpu 68060) (set #cpu 5)) 
  34. (if (= wakdt "faxx.datatype") (set extraC "\n\n&\n\n(C)opyright 1995-98 GPSoft"))
  35.  
  36. ;********************************************************************************
  37. ;English Information  
  38. ;********************************************************************************
  39. (set #about (cat "\n\n\nWelcome to the " wakdt "\n\n(C)opyright 1996-1998 by Andreas R. Kleinert" extraC) )
  40. (set #whereDTs "In what directory are the Datatypes located? (Not the 'Datatypes' dir itself, 1 level up, ie 'Classes'.) If they aren't installed, select where you wish to install them. (Default: 'SYS:classes'.)")
  41. (set #dtdirnotfound "\nThe 'Datatypes' directory was not found. Please select where you have the 'Datatypes' directory located. Do not select the 'Datatypes' directory itself, but one directory level up. If you have the datatypes in 'SYS:classes/datatypes' you would pick 'SYS:classes'.\n\n'datatypes' directory not found in:\n\n") 
  42. (set #backupdts " BackUp Current Datatype & Prefs")
  43. (set #whattodo "\nWould you like to backup the Datatypes Currently installed on your system that will be updated, along with the Prefs program if installed?\n")
  44. (set #whereback "Where would you like to BackUp the Datatypes? If a directory Called 'Datatypes' is not there one will be created. (Default is 'SYS:Storage')")
  45. (set #wherebackp "Where would you like to BackUp the Prefs Program?")
  46. (set #askcpu "\nCPU Check: What CPU does the machine have that you are installing the Datatype on? The installer has found:\n")
  47. (set #backup1 "\nThe Datatype was Backed-up to:\n")
  48. (set #backup2 "\n\nThe 'Devs:' files that were backed-up will have the <checksum> of the file appended to the file name.")
  49. (set #foundnonak1 "\nThe installer has found that you have a '")
  50. (set #foundnonak2 "' installed.  This will create a conflict with the '")
  51. (set #foundnonak3 "' that is used for decoding pictures.\n\n Is it ok to move the datatype to:\n\n")
  52. (set #Skip "Skip")
  53. (set #Delete "Delete")
  54. (set #movedt "Move DT")
  55. (set #tools "\nWhat Datatype Prefs(s) would you like to install?\n")
  56. (set #akprefs " - Prefs for ")
  57. (set #Where "Where do you wish to install ")
  58. (set #whereakprefs "? If there is a copy already there a backup of it will be created!")
  59.  
  60. (set #patching  (cat "\n\nPatching 'classes/datatypes/" wakdt "' in the archive to create the "))
  61. (set #patching1 " version to install.")
  62. (set #nowizlib "\n\nThe Prefs program needs a library called 'wizard.library'.\n\nThe installer did not find this in libs:\n\nYou can find a copy of 'wizard.library' on Aminet at:\nbiz/haage/WizardLibrary.lha")
  63.  
  64. (set #instppc "The installer has found 'libs:PPC.library'. Would you like to install the DEMO PPC module so this datatype can use it? You will need to register to get a full working PPC version, the demo only draws every 3rd line. It will be copied to: ")
  65. (set #no " No")
  66. (set #yes " Yes")
  67.  
  68. (set #vmem "If you run out of memory while trying to display a picture that uses the AK datatype it can use the hard drive as temporary memory. You will need to assign 'VMEM:' to some place if you select yes. The installer can do this if you wish.")
  69. (set #vmem1 "Going to add VMEM: assign to user-startup") 
  70. (set #Wherevmem "Where do you wish to assign 'VMEM:'")
  71.  
  72.  
  73. ;********************************************************************************
  74. ; Welcome to Install akDT
  75. ;********************************************************************************
  76. (message #about)
  77. (welcome)
  78.  
  79. ;********************************************************************************
  80. ; Ask Where the Current DTs are and check for Datatypes dir.
  81. ;********************************************************************************
  82. (set whereDTs "SYS:Classes")
  83.  
  84. (procedure getdir
  85.   (set whereDTs  (askdir (prompt #whereDTs)
  86.                          (help   #whereDTs)
  87.                          (default whereDTs) 
  88.              )
  89.   )
  90. )
  91.  
  92. (getdir)
  93.  
  94. (while (= (exists (tackon whereDTs "Datatypes")) 0) 
  95.   (
  96.     (message (cat #dtdirnotfound "'" whereDTs "'"))
  97.     (getdir)   
  98.   )
  99. )
  100.  
  101. ;********************************************************************************
  102. ; Ask to Backup the Current DTs
  103. ;********************************************************************************
  104. (set ja (askoptions   (choices #backupdts)
  105.                        (prompt #whattodo)
  106.                       (help   #whattodo)
  107.                          (default 1)
  108.     )
  109. )
  110.  
  111. ;********************************************************************************
  112. ; If Backup, ask where and make dirs
  113. ;********************************************************************************
  114. (if (= ja 1)
  115.  (
  116.   (set whereback (askdir (prompt #whereback)
  117.                          (help   #whereback)
  118.                          (default whereback) 
  119.              )
  120.   )
  121.  
  122.   (set dtdest (tackon whereback "Datatypes"))
  123.   (if (< (exists dtdest) 2)  (makedir dtdest (infos)) )
  124.   (if (< (exists (tackon dtdest "classes")) 2)  (makedir (tackon dtdest "classes") (infos)) )
  125.   (if (< (exists (tackon dtdest "classes/codecs")) 2)  (makedir (tackon dtdest "classes/codecs") (infos)) )
  126.   (if (< (exists (tackon dtdest "classes/datatypes")) 2)  (makedir (tackon dtdest "classes/datatypes") (infos)) ) 
  127.   (if (< (exists (tackon dtdest "devs")) 2)  (makedir (tackon dtdest "devs") (infos)) )
  128.   (if (< (exists (tackon dtdest "devs/datatypes")) 2)  (makedir (tackon dtdest "devs/datatypes") (infos)) ) 
  129.   (if (< (exists (tackon dtdest "libs")) 2)  (makedir (tackon dtdest "libs") (infos)) )
  130.  
  131.  )
  132. )
  133.  
  134. (set @default-dest (tackon whereback "Datatypes"))
  135.  
  136. ;********************************************************************************
  137. ; Backup Procedure 
  138. ;******************************************************************************** 
  139. (procedure backup
  140. (if (= ak 1) (set filename (substr @each-name 2)) (set filename @each-name) )
  141.  
  142.  (if (> (exists (tackon WHERE filename)) 0)
  143.   (
  144.    (set vernum1 (getversion (tackon WHERE filename)) )
  145.    (set ver1 (/ vernum1 65536))
  146.    (set rev1 (- vernum1 (* ver1 65536) ) )
  147.    (set verrev (cat ver1 "." rev1))
  148.  
  149.    (if (= cksum 1)
  150.      (
  151.        ;(working "working")
  152.        (set sum (getsum (tackon WHERE filename) ) ) 
  153.        (if (< sum 0) (set sum (* sum -1)) )
  154.        (set verrev sum)
  155.      )
  156.    )
  157.  
  158.    (set file-error (copyfiles (source (tackon WHERE filename)
  159.                                       (dest TO)
  160.                                       (newname (cat filename "." verrev))
  161.                                       (infos)
  162.                                       (optional "nofail")
  163.                               )              
  164.                    )   
  165.    )
  166.  
  167.   )
  168.  )
  169. )
  170.  
  171. ;********************************************************************************
  172. ; Set correct DT 
  173. ;******************************************************************************** 
  174. (if (= wakdt "akSVG.datatype")  (set DT "akSVG"))
  175. (if (= wakdt "akPNG.datatype")  (set DT "akPNG"))
  176. (if (= wakdt "akLJPG.datatype") (set DT "akLJPG"))
  177. (if (= wakdt "akJFIF.datatype") (set DT "akJFIF"))
  178. (if (= wakdt "akGIF.datatype")  (set DT "akGIF"))
  179. (if (= wakdt "faxx.datatype")   (set DT "faxx"))
  180.  
  181. ;********************************************************************************
  182. ; Ask what & Guess CPU 
  183. ;******************************************************************************** 
  184. (set cpuPick (askchoice (choices "68000" "68010" "68020" "68030+68881/882"
  185.                          "68040+FPU" "68060+FPU"
  186.                 )
  187.              (prompt #askcpu)
  188.                      (help   #askcpu)
  189.                    (default #cpu)
  190.       )
  191. )
  192.  
  193. (if (< cpuPick 3) 
  194.  (set wcpu "")
  195. )     
  196.  
  197. (if (= cpuPick 3) 
  198.  (
  199.   (set wcpu ".030")  (working (cat #patching wcpu #patching1))
  200.   (run (cat "c/spatch -oclasses/datatypes/" DT ".datatype.030 -pclasses/datatypes/" DT "-030.pch classes/datatypes/" DT ".datatype"))
  201.  )
  202. )
  203.  
  204. (if (= cpuPick 4) 
  205.  (
  206.   (set wcpu ".040")  (working (cat #patching wcpu #patching1))
  207.   (run (cat "c/spatch -oclasses/datatypes/" DT ".datatype.040 -pclasses/datatypes/" DT "-040.pch classes/datatypes/" DT ".datatype"))
  208.  )
  209. )
  210.  
  211. (if (= cpuPick 5) 
  212.  (
  213.   (set wcpu ".060")  (working (cat #patching wcpu #patching1))
  214.   (run (cat "c/spatch -oclasses/datatypes/" DT ".datatype.060 -pclasses/datatypes/" DT "-060.pch classes/datatypes/" DT ".datatype"))
  215.  ) 
  216. )
  217.  
  218. ;(if (= (exists (cat "classes/datatypes/" wakdt ".060")) 0) (set wcpu ".040"))
  219. ;(if (= (exists (cat "classes/datatypes/" wakdt ".040")) 0) (set wcpu ".030"))
  220. ;(if (= (exists (cat "classes/datatypes/" wakdt ".030")) 0) (set wcpu ""))
  221.  
  222. (if (= (exists (tackon "classes/datatypes" wakdt)) 0) (set wcpu "") )
  223.  
  224. ;********************************************************************************
  225. ; Look in Archive, if the File to be copied over is already there & it is ok to 
  226. ; back-up.. then Back-up file with <filename>.<ver.rev> OR <filename>.<checksum>
  227. ;******************************************************************************** 
  228. (set cksum 0) (set ak 0)
  229.  
  230.  (foreach "classes/datatypes" "#?.datatype"
  231.   ( 
  232.     (set WHERE (tackon whereDTs "datatypes"))  (set TO (tackon dtdest "classes/datatypes")) 
  233.     (if (= ja 1) (backup) ) 
  234.     (copyfiles (source (cat (tackon "classes/datatypes" @each-name) wcpu) ) (dest WHERE) (newname @each-name) (optional "nofail") (infos) ) 
  235.   )
  236.  )
  237.  
  238.  (foreach "devs/datatypes" "~(#?.info)"
  239.   ( 
  240.     (set WHERE "devs:datatypes")  (set TO (tackon dtdest "devs/datatypes"))  
  241.     (set cksum 1)    (if (= ja 1) (backup) )    (set cksum 0) 
  242.     (if (exists (tackon WHERE @each-name))
  243.      (copyfiles (source (tackon "devs/datatypes" @each-name)) (dest WHERE) (optional "nofail") ) 
  244.      (copyfiles (source (tackon "devs/datatypes" @each-name)) (dest WHERE) (optional "nofail") (infos) ) 
  245.     )
  246.  
  247.   )
  248.  )
  249.  
  250. ;********************************************************************************
  251. ; Check for PPC then
  252. ;******************************************************************************** 
  253. (set foundppc 0)
  254. (foreach "classes/datatypes" "#?.ppc"
  255.  ( (set foundppc 1) (set foundppcn @each-name) )
  256. )
  257.  
  258. (if (AND (> (exists ("libs:PPC.library")) 0)  (= foundppc 1) )
  259.  (
  260.   (set ppcq (askchoice    (choices #no #yes)
  261.                       (prompt (cat #instppc (tackon whereDTs "datatypes")) )
  262.                           (help   (cat #instppc (tackon whereDTs "datatypes")) )
  263.                      (default 1)
  264.         )
  265.   )
  266.  
  267.   (if (= ppcq 1) 
  268.    (
  269.     (set WHERE (tackon whereDTs "datatypes"))  (set TO (tackon dtdest "classes/datatypes")) 
  270.     (foreach "classes/datatypes" "#?.ppc")   (if (= ja 1) (backup) ) 
  271.     (copyfiles (source (tackon "classes/datatypes" foundppcn)) (dest (tackon whereDTs "datatypes")) (newname foundppcn) (optional "nofail") ) 
  272.    )
  273.   )
  274.  
  275.  )
  276.  
  277. )
  278.  
  279. ;********************************************************************************
  280. ;  Prefs to install, ie prefs 
  281. ;********************************************************************************
  282. (if (> (exists "Prefs/Datatypes") 0)
  283. (
  284.  
  285. (If (exists "Prefs")
  286.  (foreach "Prefs/Datatypes" "ak#?Prefs" (set wakprefs @each-name) ) 
  287.  (set wakprefs "")
  288. )
  289.  
  290. (set ToDo      (askoptions (choices (cat " " wakprefs #akprefs wakdt))
  291.                 (prompt #tools)
  292.                 (help #tools)
  293.                 (default 1)
  294.         )
  295. )
  296.  
  297. (if (IN ToDo 0)
  298.   (
  299.     (set akDrawer (askdir (prompt (cat #Where wakprefs #whereakprefs))
  300.                           (help   (cat #Where  wakprefs #whereakprefs))
  301.                   (default "SYS:Prefs/Datatypes")
  302.                   )
  303.     )
  304.  
  305.     (if (AND (> (exists (tackon akDrawer wakprefs) ) 0) (= ja 1))
  306.       (
  307.         (set wherebackp (askdir (prompt #wherebackp)
  308.                                 (help   #wherebackp)
  309.                                 (default (tackon whereback "Datatypes")) 
  310.                         )
  311.         )
  312.  
  313.         (set vernum1 (getversion (tackon akDrawer wakprefs)))
  314.         (set ver1 (/ vernum1 65536)) (set rev1 (- vernum1 (* ver1 65536) ) )
  315.  
  316.         (copyfiles (source (tackon akDrawer wakprefs))
  317.                            (dest wherebackp) (infos)
  318.                            (newname (cat wakprefs ver1 "." rev1))
  319.         )
  320.  
  321.       )
  322.     )
  323.  
  324.     (copyfiles (source (tackon "Prefs/Datatypes" wakprefs))  (dest akDrawer) (infos) (optional "force" "askuser" "nofail"))
  325.     (foreach "Prefs/Datatypes" "#?.wizard" 
  326.       (copyfiles (source (tackon "Prefs/Datatypes" @each-name))  (dest akDrawer) (infos) (optional "force" "askuser" "nofail"))
  327.     )
  328.  
  329.   )
  330. )
  331.  
  332. )
  333. ); End IFPrefsDir
  334.  
  335. ;********************************************************************************
  336. ; VMEM: if needed
  337. ;********************************************************************************
  338. (procedure VMEM
  339. (if (= (exists "VMEM:" (noreq)) 0)
  340.  (
  341.    (set ToDo1     (askoptions (choices " Add 'VMEM:' assign to user-startup")
  342.                     (prompt #vmem)
  343.                    (help #vmem)
  344.                   (default 1)
  345.                   )
  346.    )
  347.   
  348.    (if (IN ToDo1 0) 
  349.     (
  350.       (set   Drawer (askdir (prompt #Wherevmem)
  351.                             (help   #Wherevmem)
  352.                             (default "Work:")
  353.                     )
  354.       )
  355.  
  356.       (startup wakdt (prompt #vmem1) (help #vmem1) (command (cat "assign VMEM: \"" Drawer "\"")) )
  357.     )
  358.    )
  359.  
  360.  
  361.  )
  362. )
  363. ); END Procedure
  364.  
  365. (if (OR (= DT "akJFIF") (= DT "akPNG")) (VMEM) ) 
  366.  
  367. ;********************************************************************************
  368. ; Run AddDataTypes then the Pref Program
  369. ;********************************************************************************
  370. (run "AddDataTypes REFRESH")
  371.  
  372. (if (exists "Prefs/Datatypes")
  373.    (if (> (exists (tackon "Prefs/Datatypes" wakprefs)) 0) 
  374.     (
  375.      (if (> (exists "libs:wizard.library") 0) 
  376.        (run (tackon "run Prefs/Datatypes" wakprefs)) 
  377.        (message #nowizlib)
  378.      )
  379.     )
  380.    )
  381. )
  382.  
  383. ;********************************************************************************
  384. ; END  
  385. ;********************************************************************************
  386. (if (= ja 1) (message (cat #backup1 "'" (tackon whereback "Datatypes") "'\n\n" #backup2)) )
  387.